local ads__guoyi = fk.CreateSkill {
  name = "ads__guoyi",
}

ads__guoyi:addEffect(fk.EventPhaseStart, {
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    return target ~= player and player:hasSkill(ads__guoyi.name) and target.phase == Player.Draw and not data.phase_end
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askToSkillInvoke(player, {
      skill_name = ads__guoyi.name,
      prompt = "#ads__guoyi-draw"
    })
  end,
  on_use = function(self, event, target, player, data)
    player.room:drawCards(player, 1, ads__guoyi.name)
  end,
})

ads__guoyi:addEffect(fk.DamageInflicted, {
  anim_type = "defensive",
  is_delay_effect = true,
  can_trigger = function(self, event, target, player, data)
    return player:usedSkillTimes(ads__guoyi.name, Player.HistoryTurn) > 0 and target == player and
      data.card and (data.card.trueName == "slash" or data.card.name == "duel") and 
      data.from and data.from ~= player and data.by_user
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    data:changeDamage(-1)
  end,
})


Fk:loadTranslationTable{
  ["$ads__guoyi1"] = "脱！",
  ["$ads__guoyi2"] = "谁来与我大战三百回合？",
  ["ads__guoyi"] = "裹衣",
  [":ads__guoyi"] = "一名角色的摸牌阶段开始时，你可以摸一张牌，然后该角色的回合内，于你而言的其他角色使用【杀】或【决斗】对你造成伤害时，此伤害-1。",
  ["#ads__guoyi-draw"] = "是否发动“裹衣”，摸一张牌？",
}

ads__guoyi:addAI({
  think_skill_invoke = Util.TrueFunc,
})

return ads__guoyi
